package com.cy.store.mapper;

import com.cy.store.entity.User;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;

@Mapper
public interface UserMapper {
    /**
     * 增删改查返回受影响行数
     * @param user
     * @return
     */
    Integer insert(User user);

    /**
     * 根据用户名查询
     * @param username
     * @return
     */
    User findByUsername(String username);

    /**
     * 根据id修改密码
     * @param uid
     * @param password
     * @param modifiedUser
     * @param modifiedTime
     *
     * @return
     */
    Integer updatePasswordByUid(Integer uid, String password, String modifiedUser, Date modifiedTime);

    /**
     * 查询id
     * @param uid
     * @return User
     */
    User findByUid(Integer uid);

    /**
     * 修改个人资料
     * @param user
     * @return
     */
    Integer updateInfoByUid(User user);

    /**
     * 修改用户头像
     * @param
     * @return
     */
    Integer updateAvatarByUid(@Param("uid") Integer uid, @Param("avatar")String avatar, @Param("modifiedUser")String modifiedUser, @Param("modifiedTime")Date modifiedTime);
}
